[SOLVED] flash 10, as3 - save text of textarea and reuse it to replace text in textarea

Posted by user427969 on Stack Overflow See other posts from Stack Overflow or by user427969
Published on 2010-10-11T22:02:18Z Indexed on 2010/12/22 0:54 UTC
Read the original article Hit count: 519

Filed under:
|
|

hi everyone

Is it possible to save text of textarea (flash 10, as3, cs5) in some variable or so and with its textformat (more than one color) and then reuse it to replace text in textarea?

I tried saving htmlText of textarea but the problem is when i replace it in textarea

tags causes problem. There will always be another extra line.

If anyone wants to view p tags problem try following. Just click on text and then move your down arrow key, cursor will go to next line.

import fl.controls.TextArea;

var txtHTML:TextArea = new TextArea();
txtHTML.move(0,0);

var default_format:TextFormat = new TextFormat();
    default_format.font = "Arial";
    default_format.bold = false;
    default_format.align = "center";
    default_format.color = 0xFFFF00;
    default_format.size = 14;

var field:TextField = txtHTML.textField;
    field.defaultTextFormat = default_format;
    field.setTextFormat(default_format);
    field.alwaysShowSelection = true;
    field.background = true;
    field.type = 'input';
    field.multiline = true;
    field.backgroundColor = 0x777777;
    field.embedFonts = true;   
    txtHTML.htmlText = '<P ALIGN="CENTER"><FONT FACE="_sans" SIZE="14" COLOR="#FFFF00" LETTERSPACING="0" KERNING="0">ASDF</FONT></P>';
    field.x = 0;
    field.y = 0;   
    field.width = 400;
    field.height = 200;
    field.text = "";

addChild(txtHTML);

Is there a way to do this?

Thanks alot for any help. Regards

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about cs5